package com.mdd.maduoduo.adapter;

import android.graphics.Color;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.mdd.maduoduo.R;
import com.mdd.maduoduo.entity.MaxDataEntity;
import com.mdd.maduoduo.utils.CommonAdapter;
import com.mdd.maduoduo.utils.CommonViewHolder;

public class MaxDataAdapter extends CommonAdapter<MaxDataEntity.DataDTO.NormalVsMaxDtosDTO> {

    @Override
    protected int getLayoutResId(int viewType) {
        return R.layout.item_max_data;
    }

    @Override
    protected void bindData(@NonNull CommonViewHolder holder, MaxDataEntity.DataDTO.NormalVsMaxDtosDTO item, int position) {
        TextView tvTitle = holder.getView(R.id.tvTitle);
        TextView tvOne = holder.getView(R.id.tvOne);
        TextView tvTwo = holder.getView(R.id.tvTwo);
        LinearLayout llBg = holder.getView(R.id.llBg);
        if (holder.getAdapterPosition()%2==0){
            llBg.setBackgroundColor(Color.parseColor("#FFFFFF"));
        }else {
            llBg.setBackgroundColor(Color.parseColor("#F9F9F9"));
        }

        tvTitle.setText(item.functionName);
        //免费版展示类型
        switch (item.normalShowType){
            //对号
            case 0:
                tvOne.setTextColor(Color.parseColor("#00E500"));
                tvOne.setText("√");
                break;
            //叉号
            case 1:
                tvOne.setTextColor(Color.parseColor("#FF3B30"));
                tvOne.setText("×");
                break;
            //文本
            case 2:
                tvOne.setTextColor(Color.parseColor("#000000"));
                tvOne.setText(item.normalContent);
                break;
        }

        //Max版展示类型
        switch (item.maxShowType){
            //对号
            case 0:
                tvTwo.setTextColor(Color.parseColor("#00E500"));
                tvTwo.setText("√");
                break;
            //叉号
            case 1:
                tvTwo.setTextColor(Color.parseColor("#FF3B30"));
                tvTwo.setText("×");
                break;
            //文本
            case 2:
                tvTwo.setTextColor(Color.parseColor("#000000"));
                tvTwo.setText(item.maxContent);
                break;
        }
    }
}
